/*
 * @Descripttion: 
 * @version: 
 * @Author: sueRimn
 * @Date: 2021-09-06 19:01:55
 * @LastEditors: sueRimn
 * @LastEditTime: 2021-09-06 21:02:50
 */
// app.js or agent.js
class AppBootHook {
    constructor(app) {
      this.app = app;
    }
    configWillLoad() {
      // Ready to call configDidLoad,
      // Config, plugin files are referred,
      // this is the last chance to modify the config.
      console.log('configWillLoad');
    }
    configDidLoad() {
      // Config, plugin files have been loaded.
      console.log('configDidLoad');
    }
    async didLoad() {
      // All files have loaded, start plugin here.
      console.log('didLoad');
      console.log('didReady');
      //   amqp(this.app);
       
    }
    async willReady() {
      // All plugins have started, can do some thing before app ready
      console.log('willReady');

    }
    async didReady() {
      // Worker is ready, can do some things
      // don't need to block the app boot.
      const ctx = await this.app.createAnonymousContext();
      await ctx.service.mq.work()
      
    }
    async serverDidReady() {
      // Server is listening.
      console.log('serverDidReady');
    }
    async beforeClose() {
      // Do some thing before app close.
      console.log('configWillLoad');
    }
  }
  module.exports = AppBootHook;